#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Union
from sqlalchemy import String,

from sqlalchemy.orm import Mapped, mapped_column,relationship

from backend.app.core.models.base import Base, id_key


class DbmsInstanceDetail(Base):
    """系统api"""

    __tablename__ = 'dbms_instance_detail'

    id: Mapped[id_key] = mapped_column(init=False)
    instance_id: Mapped[int] = mapped_column(default=3306, comment='')
    instance_info: Mapped[str] = mapped_column(String(50), unique=True, comment='tag名称')

    status: Mapped[int] = mapped_column(default=1, comment='角色状态（0停用 1正常）')
    remark: Mapped[str | None] = mapped_column(String(255), comment='备注')
    instances: Mapped[Union['Instance', None]]= relationship(init=False, back_populates='tunnel')
